package main

import (
	"fmt"
	"time"
)


var tcnt2 <-chan time.Time

func app_sleep(ptcnt <-chan time.Time){
	ptcnt = time.After(1000 * time.Millisecond)
}


func app_pend_wake(ptcnt <-chan time.Time) bool{
	select {
		case <-ptcnt:
			return true
		default:
			return false
	} 
}


func main() {
	fmt.Println(tcnt2)
	tcnt2 = time.After(1000 * time.Millisecond)
	for true {
		if(app_pend_wake(tcnt2)){
			app_sleep(tcnt2);
			fmt.Println("run2")
		}
		
		time.Sleep(10*time.Millisecond)
	}
	

	
}

